<!DOCTYPE html>
<html lang=zh>
<head>
    <!-- so meta -->
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="HandheldFriendly" content="True">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1" />
    <meta name="description" content="安装如果不会安装docker可参考下边这篇博客 博客地址：http:&#x2F;&#x2F;www.geekfaith.com&#x2F;article&#x2F;173  1docker run -d -p 9200:9200 -p 9300:9300 -v &#x2F;opt&#x2F;myapp&#x2F;elasticsearch&#x2F;config&#x2F;elasticsearch.yml:&#x2F;usr&amp;#x2F">
<meta property="og:type" content="article">
<meta property="og:title" content="在docker中安装es（单机版）">
<meta property="og:url" content="https:&#x2F;&#x2F;fengzxia.gitee.io&#x2F;posts&#x2F;d9b5a8fb.html">
<meta property="og:site_name" content="只是学习学习的博客">
<meta property="og:description" content="安装如果不会安装docker可参考下边这篇博客 博客地址：http:&#x2F;&#x2F;www.geekfaith.com&#x2F;article&#x2F;173  1docker run -d -p 9200:9200 -p 9300:9300 -v &#x2F;opt&#x2F;myapp&#x2F;elasticsearch&#x2F;config&#x2F;elasticsearch.yml:&#x2F;usr&amp;#x2F">
<meta property="og:locale" content="zh_CN">
<meta property="article:published_time" content="2019-04-04T09:52:22.000Z">
<meta property="article:modified_time" content="2020-04-16T12:11:09.289Z">
<meta property="article:author" content="只是学习学习">
<meta property="article:tag" content="Java">
<meta property="article:tag" content="Python">
<meta property="article:tag" content="Spider">
<meta property="article:tag" content="Spring">
<meta property="article:tag" content="Redis">
<meta property="article:tag" content="Mybatis">
<meta property="article:tag" content="Mysql">
<meta name="twitter:card" content="summary">
    
    
        
          
              <link rel="shortcut icon" href="/images/favicon.ico">
          
        
        
          
            <link rel="icon" type="image/png" href="/images/favicon-192x192.png" sizes="192x192">
          
        
        
          
            <link rel="apple-touch-icon" sizes="180x180" href="/images/apple-touch-icon.png">
          
        
    
    <!-- title -->
    <title>在docker中安装es（单机版）</title>
    <!-- styles -->
    
<link rel="stylesheet" href="/css/style.css">

    <!-- persian styles -->
    
      
<link rel="stylesheet" href="/css/rtl.css">

    
    <!-- rss -->
    
    
    
<meta name="generator" content="Hexo 4.1.1"></head>

<body class="max-width mx-auto px3 ltr">
    
      <div id="header-post">
  <a id="menu-icon" href="#"><i class="fas fa-bars fa-lg"></i></a>
  <a id="menu-icon-tablet" href="#"><i class="fas fa-bars fa-lg"></i></a>
  <a id="top-icon-tablet" href="#" onclick="$('html, body').animate({ scrollTop: 0 }, 'fast');" style="display:none;"><i class="fas fa-chevron-up fa-lg"></i></a>
  <span id="menu">
    <span id="nav">
      <ul>
         
          <li><a href="/">主页</a></li>
         
          <li><a href="/archives/">归档</a></li>
         
          <li><a href="/categories/">分类</a></li>
         
          <li><a href="/tags/">标签</a></li>
         
          <li><a href="/search/">搜索</a></li>
         
          <li><a href="/about/">关于</a></li>
         
          <li><a href="/friend_ship/">友链</a></li>
        
      </ul>
    </span>
    <br/>
    <span id="actions">
      <ul>
        
        <li><a class="icon" href="/posts/4d14a8a8.html"><i class="fas fa-chevron-left" aria-hidden="true" onmouseover="$('#i-prev').toggle();" onmouseout="$('#i-prev').toggle();"></i></a></li>
        
        
        <li><a class="icon" href="/posts/516d82c4.html"><i class="fas fa-chevron-right" aria-hidden="true" onmouseover="$('#i-next').toggle();" onmouseout="$('#i-next').toggle();"></i></a></li>
        
        <li><a class="icon" href="#" onclick="$('html, body').animate({ scrollTop: 0 }, 'fast');"><i class="fas fa-chevron-up" aria-hidden="true" onmouseover="$('#i-top').toggle();" onmouseout="$('#i-top').toggle();"></i></a></li>
        <li><a class="icon" href="#"><i class="fas fa-share-alt" aria-hidden="true" onmouseover="$('#i-share').toggle();" onmouseout="$('#i-share').toggle();" onclick="$('#share').toggle();return false;"></i></a></li>
      </ul>
      <span id="i-prev" class="info" style="display:none;">上一篇</span>
      <span id="i-next" class="info" style="display:none;">下一篇</span>
      <span id="i-top" class="info" style="display:none;">返回顶部</span>
      <span id="i-share" class="info" style="display:none;">分享文章</span>
    </span>
    <br/>
    <div id="share" style="display: none">
      <ul>
  <li><a class="icon" href="http://www.facebook.com/sharer.php?u=https://fengzxia.gitee.io/posts/d9b5a8fb.html" target="_blank" rel="noopener"><i class="fab fa-facebook " aria-hidden="true"></i></a></li>
  <li><a class="icon" href="https://twitter.com/share?url=https://fengzxia.gitee.io/posts/d9b5a8fb.html&text=在docker中安装es（单机版）" target="_blank" rel="noopener"><i class="fab fa-twitter " aria-hidden="true"></i></a></li>
  <li><a class="icon" href="http://www.linkedin.com/shareArticle?url=https://fengzxia.gitee.io/posts/d9b5a8fb.html&title=在docker中安装es（单机版）" target="_blank" rel="noopener"><i class="fab fa-linkedin " aria-hidden="true"></i></a></li>
  <li><a class="icon" href="https://pinterest.com/pin/create/bookmarklet/?url=https://fengzxia.gitee.io/posts/d9b5a8fb.html&is_video=false&description=在docker中安装es（单机版）" target="_blank" rel="noopener"><i class="fab fa-pinterest " aria-hidden="true"></i></a></li>
  <li><a class="icon" href="mailto:?subject=在docker中安装es（单机版）&body=Check out this article: https://fengzxia.gitee.io/posts/d9b5a8fb.html"><i class="fas fa-envelope " aria-hidden="true"></i></a></li>
  <li><a class="icon" href="https://getpocket.com/save?url=https://fengzxia.gitee.io/posts/d9b5a8fb.html&title=在docker中安装es（单机版）" target="_blank" rel="noopener"><i class="fab fa-get-pocket " aria-hidden="true"></i></a></li>
  <li><a class="icon" href="http://reddit.com/submit?url=https://fengzxia.gitee.io/posts/d9b5a8fb.html&title=在docker中安装es（单机版）" target="_blank" rel="noopener"><i class="fab fa-reddit " aria-hidden="true"></i></a></li>
  <li><a class="icon" href="http://www.stumbleupon.com/submit?url=https://fengzxia.gitee.io/posts/d9b5a8fb.html&title=在docker中安装es（单机版）" target="_blank" rel="noopener"><i class="fab fa-stumbleupon " aria-hidden="true"></i></a></li>
  <li><a class="icon" href="http://digg.com/submit?url=https://fengzxia.gitee.io/posts/d9b5a8fb.html&title=在docker中安装es（单机版）" target="_blank" rel="noopener"><i class="fab fa-digg " aria-hidden="true"></i></a></li>
  <li><a class="icon" href="http://www.tumblr.com/share/link?url=https://fengzxia.gitee.io/posts/d9b5a8fb.html&name=在docker中安装es（单机版）&description=" target="_blank" rel="noopener"><i class="fab fa-tumblr " aria-hidden="true"></i></a></li>
  <li><a class="icon" href="https://news.ycombinator.com/submitlink?u=https://fengzxia.gitee.io/posts/d9b5a8fb.html&t=在docker中安装es（单机版）" target="_blank" rel="noopener"><i class="fab fa-hacker-news " aria-hidden="true"></i></a></li>
</ul>

    </div>
    <div id="toc">
      <ol class="toc"><li class="toc-item toc-level-2"><a class="toc-link" href="#安装"><span class="toc-number">1.</span> <span class="toc-text">安装</span></a><ol class="toc-child"><li class="toc-item toc-level-3"><a class="toc-link" href="#如果不会安装docker可参考下边这篇博客"><span class="toc-number">1.1.</span> <span class="toc-text">如果不会安装docker可参考下边这篇博客</span></a></li></ol></li><li class="toc-item toc-level-2"><a class="toc-link" href="#碰到的问题"><span class="toc-number">2.</span> <span class="toc-text">碰到的问题</span></a><ol class="toc-child"><li class="toc-item toc-level-3"><a class="toc-link" href="#1-只能访问9200端口，在项目中不能使用9300端口操作"><span class="toc-number">2.1.</span> <span class="toc-text">1.只能访问9200端口，在项目中不能使用9300端口操作</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#配置过9300端口外网启动后，启动es可能会报如下错误"><span class="toc-number">2.2.</span> <span class="toc-text">配置过9300端口外网启动后，启动es可能会报如下错误</span></a><ol class="toc-child"><li class="toc-item toc-level-4"><a class="toc-link" href="#看上边的日志，可以发现还报一个错误"><span class="toc-number">2.2.1.</span> <span class="toc-text">看上边的日志，可以发现还报一个错误</span></a></li></ol></li><li class="toc-item toc-level-3"><a class="toc-link" href="#进入docker容器命令"><span class="toc-number">2.3.</span> <span class="toc-text">进入docker容器命令</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#docker中默认未安装vim编辑器，需要自己下载"><span class="toc-number">2.4.</span> <span class="toc-text">docker中默认未安装vim编辑器，需要自己下载</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#查看docker容器ip"><span class="toc-number">2.5.</span> <span class="toc-text">查看docker容器ip</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#查看启动日志"><span class="toc-number">2.6.</span> <span class="toc-text">查看启动日志</span></a></li></ol></li></ol>
    </div>
  </span>
</div>

    
    <div class="content index py4">
        
        <article class="post" itemscope itemtype="http://schema.org/BlogPosting">
  <header>
    
    <h1 class="posttitle" itemprop="name headline">
        在docker中安装es（单机版）
    </h1>



    <div class="meta">
      <span class="author" itemprop="author" itemscope itemtype="http://schema.org/Person">
        <span itemprop="name">只是学习学习的博客</span>
      </span>
      
    <div class="postdate">
      
        <time datetime="2019-04-04T09:52:22.000Z" itemprop="datePublished">2019-04-04</time>
        
      
    </div>


      
    <div class="article-category">
        <i class="fas fa-archive"></i>
        <a class="category-link" href="/categories/DB/">DB</a> › <a class="category-link" href="/categories/DB/NoSQL/">NoSQL</a> › <a class="category-link" href="/categories/DB/NoSQL/Elasticsearch/">Elasticsearch</a> › <a class="category-link" href="/categories/Docker/">Docker</a> › <a class="category-link" href="/categories/ELK/">ELK</a> › <a class="category-link" href="/categories/ELK/Elasticsearch/">Elasticsearch</a>
    </div>


      

    </div>
  </header>
  

  <div class="content"itemprop ="articleBody">
    <h2 id="安装"><a href="#安装" class="headerlink" title="安装"></a>安装</h2><h3 id="如果不会安装docker可参考下边这篇博客"><a href="#如果不会安装docker可参考下边这篇博客" class="headerlink" title="如果不会安装docker可参考下边这篇博客"></a>如果不会安装docker可参考下边这篇博客</h3><blockquote>
<p>博客地址：<a href="http://www.geekfaith.com/article/173" target="_blank" rel="noopener">http://www.geekfaith.com/article/173</a></p>
</blockquote>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">docker run -d -p 9200:9200 -p 9300:9300 -v &#x2F;opt&#x2F;myapp&#x2F;elasticsearch&#x2F;config&#x2F;elasticsearch.yml:&#x2F;usr&#x2F;share&#x2F;elasticsearch&#x2F;config&#x2F;elasticsearch.yml -v  &#x2F;opt&#x2F;myapp&#x2F;elasticsearch&#x2F;config&#x2F;jvm.options:&#x2F;usr&#x2F;share&#x2F;elasticsearch&#x2F;config&#x2F;jvm.options --name elasticsearch elasticsearch</span><br></pre></td></tr></table></figure>

<ul>
<li>-p：将docker镜像中的端口号映射宿主机器端口号，<code>宿主机器端口号:docker容器端口号</code> ，可写多个，如果多个端口号是连续的，可以直接用-连接，如：4560-4600:4560-4600</li>
<li>-v：将docker镜像中的文件映射到宿主机器指定的文件，可以是文件夹，<code>-v 宿主机文件:容器文件</code>映射后可直接修改宿主机上的文件就可以改变docker中的配置，也可写多个。docker镜像中软件的配置文档默认在<code>/usr/share”/{软件名}</code>下</li>
<li>–name：指定镜像名称,<code>--name 容器名称</code></li>
</ul>
<blockquote>
<p><strong>默认安装的是docker镜像中最新版本的es镜像，如果想要安装指定版本，需要先下载镜像，比如我想安装5.几版本的es<br>先通过docker下载该版本的镜像</strong></p>
</blockquote>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">docker pull elasticsearch:5.6.9</span><br></pre></td></tr></table></figure>
<p>下载完镜像后再输入上边的安装命令，docker会使用已下载的镜像安装</p>
<h2 id="碰到的问题"><a href="#碰到的问题" class="headerlink" title="碰到的问题"></a>碰到的问题</h2><h3 id="1-只能访问9200端口，在项目中不能使用9300端口操作"><a href="#1-只能访问9200端口，在项目中不能使用9300端口操作" class="headerlink" title="1.只能访问9200端口，在项目中不能使用9300端口操作"></a>1.只能访问9200端口，在项目中不能使用9300端口操作</h3><p>期初以为是防火墙给拦截，后台查看防火墙发现并未被拦截，检查docker容器中es的配置文件，容器目录(<code>/usr/share/elasticsearch/config/elasticsearch.yml</code>)，使用vim查看文件发现只有一行配置</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">http.host: 0.0.0.0</span><br></pre></td></tr></table></figure>
<p>这里只是设置了9200端口可以外网访问</p>
<p>还需要添加如下配置才能访问9300端口，添加后重启es即可访问</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line">bootstrap.system_call_filter: false</span><br><span class="line">network.bind_host: 0.0.0.0</span><br><span class="line">network.publish_host: 填写docker容器的内网ip</span><br><span class="line">network.host: 0.0.0.0</span><br></pre></td></tr></table></figure>
<h3 id="配置过9300端口外网启动后，启动es可能会报如下错误"><a href="#配置过9300端口外网启动后，启动es可能会报如下错误" class="headerlink" title="配置过9300端口外网启动后，启动es可能会报如下错误"></a>配置过9300端口外网启动后，启动es可能会报如下错误</h3><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br></pre></td><td class="code"><pre><span class="line">ERROR: [2] bootstrap checks failed</span><br><span class="line">ERROR: [2] bootstrap checks failed[1]: initial heap size [31457280] not equal to maximum heap size [480247808];</span><br><span class="line">this can cause resize pauses and prevents mlockall from locking the entire heap[2]: max virtual memory areas vm.max_map_count [65530] is too low, increase to 	</span><br><span class="line">at least [262144][2018-11-01T11:49:45,152][INFO ][o.e.n.Node               ] [qfspMqR] stopping ...2018-11-01 11:49:45,155 pool-1-thread-1 </span><br><span class="line">ERROR Unable to unregister MBeans java.security.AccessControlException: access denied (&quot;javax.management.MBeanServerPermission&quot; &quot;createMBeanServer&quot;)</span><br><span class="line">at java.security.AccessControlContext.checkPermission(AccessControlContext.java:472) at </span><br><span class="line">java.security.AccessController.checkPermission(AccessController.java:884) at java.lang.SecurityManager.checkPermission(SecurityManager.java:549) at </span><br><span class="line">java.lang.management.ManagementFactory.getPlatformMBeanServer(ManagementFactory.java:465) at </span><br><span class="line">org.apache.logging.log4j.core.jmx.Server.unregisterLoggerContext(Server.java:246) at org.apache.logging.log4j.core.LoggerContext.stop(LoggerContext.java:338) </span><br><span class="line">at org.apache.logging.log4j.core.LoggerContext$1.run(LoggerContext.java:279) at </span><br><span class="line">org.apache.logging.log4j.core.util.DefaultShutdownCallbackRegistry$RegisteredCancellable.run(DefaultShutdownCallbackRegistry.java:109) at </span><br><span class="line">org.apache.logging.log4j.core.util.DefaultShutdownCallbackRegistry.run(DefaultShutdownCallbackRegistry.java:74) at java.lang.Thread.run(Thread.java:748)</span><br></pre></td></tr></table></figure>
<p>这个是因为linux的单个进程的线程数不够，需要调大，临时加大的方法：</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br></pre></td><td class="code"><pre><span class="line">sysctl -w vm.max_map_count&#x3D;262144</span><br><span class="line"></span><br><span class="line">#查看修改结果</span><br><span class="line">sysctl -a|grep vm.max_map_count</span><br><span class="line">示例：</span><br><span class="line">[root@localhost config]# sysctl -a|grep vm.max_map_count</span><br><span class="line">vm.max_map_count &#x3D; 262144</span><br></pre></td></tr></table></figure>
<p>永久修改方法，按照如下命令一次输入：</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br></pre></td><td class="code"><pre><span class="line">cat &#x2F;etc&#x2F;sysctl.conf | grep -v &quot;vm.max_map_count&quot; &gt; &#x2F;tmp&#x2F;system_sysctl.conf</span><br><span class="line"></span><br><span class="line">echo &quot;vm.max_map_count&#x3D;262144&quot; &gt;&gt; &#x2F;tmp&#x2F;system_sysctl.conf</span><br><span class="line"></span><br><span class="line">mv &#x2F;tmp&#x2F;system_sysctl.conf &#x2F;etc&#x2F;sysctl.conf    #会提示是否覆盖，输入”y“即可</span><br><span class="line">然后输入命令更新配置</span><br><span class="line">cat &#x2F;etc&#x2F;sysctl.conf</span><br><span class="line"></span><br><span class="line">sysctl -p</span><br></pre></td></tr></table></figure>
<h4 id="看上边的日志，可以发现还报一个错误"><a href="#看上边的日志，可以发现还报一个错误" class="headerlink" title="看上边的日志，可以发现还报一个错误"></a>看上边的日志，可以发现还报一个错误</h4><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">bootstrap checks failed[1]: initial heap size [31457280] not equal to maximum heap size [480247808];</span><br></pre></td></tr></table></figure>
<p>因为服务器内存不够，es默认的jvm分配过多,修改<code>/usr/share/elasticsearch/config/jvm.options</code>(容器目录)的-Xms和-Xmx,默认是4g</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">-Xms256m</span><br><span class="line">-Xmx256m</span><br></pre></td></tr></table></figure>
<p>修改后重启即可使用</p>
<h3 id="进入docker容器命令"><a href="#进入docker容器命令" class="headerlink" title="进入docker容器命令"></a>进入docker容器命令</h3><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">docker exec -i -t 容器名 bash</span><br></pre></td></tr></table></figure>
<h3 id="docker中默认未安装vim编辑器，需要自己下载"><a href="#docker中默认未安装vim编辑器，需要自己下载" class="headerlink" title="docker中默认未安装vim编辑器，需要自己下载"></a>docker中默认未安装vim编辑器，需要自己下载</h3><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">apt-get install vim</span><br></pre></td></tr></table></figure>

<p>如果安装时提示如下</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line">Reading package lists... Done</span><br><span class="line">        Building dependency tree       </span><br><span class="line">        Reading state information... Done</span><br><span class="line">        E: Unable to locate package vim</span><br></pre></td></tr></table></figure>
<p>这时候需要敲：<code>apt-get update</code>，这个命令的作用是：同步<code>/etc/apt/sources.list</code>和<code>/etc/apt/sources.list.d</code>中列出的源的索引，这样才能获取到最新的软件包。<br>然后再输入<code>apt-get install vim</code>就可安装成功</p>
<h3 id="查看docker容器ip"><a href="#查看docker容器ip" class="headerlink" title="查看docker容器ip"></a>查看docker容器ip</h3><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">docker inspect &#123;容器名&#125; | grep IPAddress</span><br></pre></td></tr></table></figure>

<h3 id="查看启动日志"><a href="#查看启动日志" class="headerlink" title="查看启动日志"></a>查看启动日志</h3><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">docker logs -f --tail&#x3D;10 &#123;容器名称&#125;</span><br></pre></td></tr></table></figure>
<p>查看指定docker容器的日志，ctrl+c 结束查看</p>
<ul>
<li><code>–tail</code>：从倒数第几行开始查看</li>
<li><code>-f</code>：带上日志时间查看</li>
</ul>

<div id="gitalk-container"></div>
<script src="https://cdn.bootcss.com/blueimp-md5/2.12.0/js/md5.min.js"></script><link rel="stylesheet" href="https://unpkg.com/gitalk/dist/gitalk.css"><script src="https://unpkg.com/gitalk/dist/gitalk.min.js"></script>

		<script>
		var gitalkConfig = {"clientID":"28a065e3b5afee156f4f","clientSecret":"e18104d6f3219526491fc42c892ff6a26b8f3e74","repo":"blog_comment","owner":"FENG1000","admin":["FENG1000"],"distractionFreeMode":false};
	    gitalkConfig.id = md5(location.pathname);
		var gitalk = new Gitalk(gitalkConfig);
	    gitalk.render("gitalk-container");
	    </script>
    
  <blockquote>
      <p>
          作者: 只是学习学习<br>
          邮箱: fengzxia1000@163.com<br>
          原文地址: <a href="https://fengzxia.gitee.io/posts/d9b5a8fb.html" target="_blank" rel="noopener">https://fengzxia.gitee.io/posts/d9b5a8fb.html</a><br>
          版权声明: 商业转载请联系作者获得授权，非商业转载请注明出处。
      </p>
  </blockquote>

  <script>
      function setClipboardText(event){
          // clipboardData 对象是为通过编辑菜单、快捷菜单和快捷键执行的编辑操作所保留的，也就是你复制或者剪切内容
          let clipboardData = event.clipboardData || window.clipboardData;
          // 如果未复制或者未剪切，则return出去
          if (!clipboardData) { return; }
          event.preventDefault();
          // Selection 对象，表示用户选择的文本范围或光标的当前位置。
          //     声明一个变量接收 -- 用户输入的剪切或者复制的文本转化为字符串
          let text = window.getSelection().toString();

          if (text) {
            // 如果文本存在则先取消文本默认事件
            event.preventDefault();
            // 通过调用常clipboardData对象的 setData(format, data) 方法；来设置相关文本
            // format: 一个DOMString 表示要添加到 drag object的拖动数据的类型。
            // data: 一个 DOMString表示要添加到 drag object的数据。
            var copyright = '\n\n'
                            + '\n著作权归作者所有。'
                            + '\n商业转载请联系作者获得授权，非商业转载请注明出处。'
                            + '\n作者: 只是学习学习'
                            + '\n邮箱: fengzxia1000@163.com'
                            + '\n原文地址: https://fengzxia.gitee.io/posts/d9b5a8fb.html'

            clipboardData.setData('text/plain', text + copyright);

          }
      };
      var contents = document.getElementsByClassName("content");
      // 监听文章内容的copy事件
      contents[0].addEventListener('copy',function(e){
          setClipboardText(e);
      });
  </script>

  </div>
</article>




        
          <div id="footer-post-container">
  <div id="footer-post">

    <div id="nav-footer" style="display: none">
      <ul>
         
          <li><a href="/">主页</a></li>
         
          <li><a href="/archives/">归档</a></li>
         
          <li><a href="/categories/">分类</a></li>
         
          <li><a href="/tags/">标签</a></li>
         
          <li><a href="/search/">搜索</a></li>
         
          <li><a href="/about/">关于</a></li>
         
          <li><a href="/friend_ship/">友链</a></li>
        
      </ul>
    </div>

    <div id="toc-footer" style="display: none">
      <ol class="toc"><li class="toc-item toc-level-2"><a class="toc-link" href="#安装"><span class="toc-number">1.</span> <span class="toc-text">安装</span></a><ol class="toc-child"><li class="toc-item toc-level-3"><a class="toc-link" href="#如果不会安装docker可参考下边这篇博客"><span class="toc-number">1.1.</span> <span class="toc-text">如果不会安装docker可参考下边这篇博客</span></a></li></ol></li><li class="toc-item toc-level-2"><a class="toc-link" href="#碰到的问题"><span class="toc-number">2.</span> <span class="toc-text">碰到的问题</span></a><ol class="toc-child"><li class="toc-item toc-level-3"><a class="toc-link" href="#1-只能访问9200端口，在项目中不能使用9300端口操作"><span class="toc-number">2.1.</span> <span class="toc-text">1.只能访问9200端口，在项目中不能使用9300端口操作</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#配置过9300端口外网启动后，启动es可能会报如下错误"><span class="toc-number">2.2.</span> <span class="toc-text">配置过9300端口外网启动后，启动es可能会报如下错误</span></a><ol class="toc-child"><li class="toc-item toc-level-4"><a class="toc-link" href="#看上边的日志，可以发现还报一个错误"><span class="toc-number">2.2.1.</span> <span class="toc-text">看上边的日志，可以发现还报一个错误</span></a></li></ol></li><li class="toc-item toc-level-3"><a class="toc-link" href="#进入docker容器命令"><span class="toc-number">2.3.</span> <span class="toc-text">进入docker容器命令</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#docker中默认未安装vim编辑器，需要自己下载"><span class="toc-number">2.4.</span> <span class="toc-text">docker中默认未安装vim编辑器，需要自己下载</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#查看docker容器ip"><span class="toc-number">2.5.</span> <span class="toc-text">查看docker容器ip</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#查看启动日志"><span class="toc-number">2.6.</span> <span class="toc-text">查看启动日志</span></a></li></ol></li></ol>
    </div>

    <div id="share-footer" style="display: none">
      <ul>
  <li><a class="icon" href="http://www.facebook.com/sharer.php?u=https://fengzxia.gitee.io/posts/d9b5a8fb.html" target="_blank" rel="noopener"><i class="fab fa-facebook fa-lg" aria-hidden="true"></i></a></li>
  <li><a class="icon" href="https://twitter.com/share?url=https://fengzxia.gitee.io/posts/d9b5a8fb.html&text=在docker中安装es（单机版）" target="_blank" rel="noopener"><i class="fab fa-twitter fa-lg" aria-hidden="true"></i></a></li>
  <li><a class="icon" href="http://www.linkedin.com/shareArticle?url=https://fengzxia.gitee.io/posts/d9b5a8fb.html&title=在docker中安装es（单机版）" target="_blank" rel="noopener"><i class="fab fa-linkedin fa-lg" aria-hidden="true"></i></a></li>
  <li><a class="icon" href="https://pinterest.com/pin/create/bookmarklet/?url=https://fengzxia.gitee.io/posts/d9b5a8fb.html&is_video=false&description=在docker中安装es（单机版）" target="_blank" rel="noopener"><i class="fab fa-pinterest fa-lg" aria-hidden="true"></i></a></li>
  <li><a class="icon" href="mailto:?subject=在docker中安装es（单机版）&body=Check out this article: https://fengzxia.gitee.io/posts/d9b5a8fb.html"><i class="fas fa-envelope fa-lg" aria-hidden="true"></i></a></li>
  <li><a class="icon" href="https://getpocket.com/save?url=https://fengzxia.gitee.io/posts/d9b5a8fb.html&title=在docker中安装es（单机版）" target="_blank" rel="noopener"><i class="fab fa-get-pocket fa-lg" aria-hidden="true"></i></a></li>
  <li><a class="icon" href="http://reddit.com/submit?url=https://fengzxia.gitee.io/posts/d9b5a8fb.html&title=在docker中安装es（单机版）" target="_blank" rel="noopener"><i class="fab fa-reddit fa-lg" aria-hidden="true"></i></a></li>
  <li><a class="icon" href="http://www.stumbleupon.com/submit?url=https://fengzxia.gitee.io/posts/d9b5a8fb.html&title=在docker中安装es（单机版）" target="_blank" rel="noopener"><i class="fab fa-stumbleupon fa-lg" aria-hidden="true"></i></a></li>
  <li><a class="icon" href="http://digg.com/submit?url=https://fengzxia.gitee.io/posts/d9b5a8fb.html&title=在docker中安装es（单机版）" target="_blank" rel="noopener"><i class="fab fa-digg fa-lg" aria-hidden="true"></i></a></li>
  <li><a class="icon" href="http://www.tumblr.com/share/link?url=https://fengzxia.gitee.io/posts/d9b5a8fb.html&name=在docker中安装es（单机版）&description=" target="_blank" rel="noopener"><i class="fab fa-tumblr fa-lg" aria-hidden="true"></i></a></li>
  <li><a class="icon" href="https://news.ycombinator.com/submitlink?u=https://fengzxia.gitee.io/posts/d9b5a8fb.html&t=在docker中安装es（单机版）" target="_blank" rel="noopener"><i class="fab fa-hacker-news fa-lg" aria-hidden="true"></i></a></li>
</ul>

    </div>

    <div id="actions-footer">
        <a id="menu" class="icon" href="#" onclick="$('#nav-footer').toggle();return false;"><i class="fas fa-bars fa-lg" aria-hidden="true"></i> 菜单</a>
        <a id="toc" class="icon" href="#" onclick="$('#toc-footer').toggle();return false;"><i class="fas fa-list fa-lg" aria-hidden="true"></i> 目录</a>
        <a id="share" class="icon" href="#" onclick="$('#share-footer').toggle();return false;"><i class="fas fa-share-alt fa-lg" aria-hidden="true"></i> 分享</a>
        <a id="top" style="display:none" class="icon" href="#" onclick="$('html, body').animate({ scrollTop: 0 }, 'fast');"><i class="fas fa-chevron-up fa-lg" aria-hidden="true"></i> 返回顶部</a>
    </div>

  </div>
</div>

        
        <footer id="footer">
  <div class="footer-left">
    Copyright &copy;
    
    
    2019-2020
    只是学习学习
  </div>
  <div class="footer-right">
    <nav>
      <ul>
         
          <li><a href="/">主页</a></li>
         
          <li><a href="/archives/">归档</a></li>
         
          <li><a href="/categories/">分类</a></li>
         
          <li><a href="/tags/">标签</a></li>
         
          <li><a href="/search/">搜索</a></li>
         
          <li><a href="/about/">关于</a></li>
         
          <li><a href="/friend_ship/">友链</a></li>
        
      </ul>
    </nav>
  </div>
</footer>

    </div>
    <!-- styles -->

<link rel="stylesheet" href="/lib/font-awesome/css/all.min.css">


<link rel="stylesheet" href="/lib/justified-gallery/css/justifiedGallery.min.css">


    <!-- jquery -->

<script src="/lib/jquery/jquery.min.js"></script>


<script src="/lib/justified-gallery/js/jquery.justifiedGallery.min.js"></script>

<!-- clipboard -->

  
<script src="/lib/clipboard/clipboard.min.js"></script>

  <script type="text/javascript">
  $(function() {
    // copy-btn HTML
    var btn = "<span class=\"btn-copy tooltipped tooltipped-sw\" aria-label=\"复制到粘贴板!\">";
    btn += '<i class="far fa-clone"></i>';
    btn += '</span>'; 
    // mount it!
    $(".highlight table").before(btn);
    var clip = new ClipboardJS('.btn-copy', {
      text: function(trigger) {
        return Array.from(trigger.nextElementSibling.querySelectorAll('.code')).reduce((str,it)=>str+it.innerText+'\n','')
      }
    });
    clip.on('success', function(e) {
      e.trigger.setAttribute('aria-label', "复制成功!");
      e.clearSelection();
    })
  })
  </script>


<script src="/js/main.js"></script>

<!-- search -->

<!-- Google Analytics -->

<!-- Baidu Analytics -->

    <script type="text/javascript">
        var _hmt = _hmt || [];
        (function() {
            var hm = document.createElement("script");
            hm.src = "https://hm.baidu.com/hm.js?54382acbd8c4bc66535bce135e0ac166";
            var s = document.getElementsByTagName("script")[0];
            s.parentNode.insertBefore(hm, s);
        })();
    </script>

<!-- Disqus Comments -->


</body>
<script>
(function(){
    var bp = document.createElement('script');
    var curProtocol = window.location.protocol.split(':')[0];
    if (curProtocol === 'https'){
   bp.src = 'https://zz.bdstatic.com/linksubmit/push.js';
  }
  else{
  bp.src = 'http://push.zhanzhang.baidu.com/push.js';
  }
    var s = document.getElementsByTagName("script")[0];
    s.parentNode.insertBefore(bp, s);
})();
</script>
</html>
